package com.itheima.futrue;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo01 {


    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable<String> my=new MyCallable();//call  call 有返回值
        FutureTask futureTask = new FutureTask<String>(my);
        Thread thread = new Thread(futureTask);
        thread.start();
        FutureTask futureTask2 = new FutureTask<String>(my);
        Thread thread2 = new Thread(futureTask2);
        thread2.start();
        Object result1 = futureTask.get();
        Object result2 = futureTask2.get();
        System.out.println(result1);
        System.out.println(result2);
        for (int i = 0; i < 100; i++) {
            System.out.println("main执行到了"+i
            );
        }

    }
}
